package db.tools;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;

public class ReloadAll {

	/**
	 * @param args
	 * @throws SQLException 
	 * @throws ClassNotFoundException 
	 * @throws IOException 
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException {
		File lockFile = new File("resources/bubble_data.lock.db");
		if (lockFile.exists()) {
			lockFile.delete();
		}
		File dbFile = new File("resources/bubble_data.h2.db");
		if (dbFile.exists()) {
			dbFile.delete();
		}
		CreateDatabase.main(new String[0]);
		LoadXLS.main(new String[] {"resources/indicatorgapmindergdp_per_capita_ppp.xls", "Income", "Country"});
		LoadXLS.main(new String[] {"resources/indicatorgapminderpopulation.xls", "Population", "Country"});
		LoadXLS.main(new String[] {"resources/indicatorlife_expectancy_at_birth.xls", "Life expectancy", "Country"});
		
	}

}
